<?php
	/*此php模块，展示类*/
	$pk = new web_analyze(); 
	$rel = $pk->get_content('http://www.medvip.com.cn/channels/512.html');
	$title = $pk->get_title($rel);
	$link = $pk->get_link_of_list($rel);

	class web_analyze{
		//针对一个网站做采集测试
		private $web_name = '国家职业药师考试网';
		private $web_url = 'http://www.medvip.com.cn/';
		private $list_link = 'http://www.medvip.com.cn/channels/512.html';//http://www.medvip.com.cn/channels/512_(*).html

		public function get_content($url){
			//获取某个页面的html代码

			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, $url);
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

			$page = curl_exec($ch);
			$page = mb_convert_encoding($page, 'UTF-8', 'gb2312');
			curl_close($ch);
			unset($ch);
			return htmlentities($page);
		}

		public function get_title($page){
			//传入采集得到的页面html，从中提取出来标题
			$p_title = '/(<title>([\w\s\W\S]*?)<\/title>)/';
			preg_match_all($p_title, $page, $match);
			return $match;
		}

		public function get_link_of_list($page){
			//获取列表页中的链接集合
			$list = '//';
			return $page;
		}
	}
?>